package com.dc.refactoring._3_重新组织数据._2_ReplaceDataValueWithObject.newObject;

/**
 * Description: 以对象取代数据值_改造后订单类
 * @author: gdc
 * @date: 2020/11/16
 * @version 1.0
 */
public class Order {

    // 【3】修改字段类型为 Customer，并创建新的设值、取值函数
    private Customer customer;

    public Order(String customerName) {
        this.customer = new Customer(customerName);
    }

    public Customer getCustomer() {
        return customer;
    }

    public void setCustomer(String customerName) {
        this.customer = new Customer(customerName);
    }


    // 【5】修改方法名，使其清晰的表达
    public String getCustomerName() {
        // 【4】修改引用 customer 字段的函数
        return customer.getName();
    }
}
